@import 'mixins/animations';
@import 'mixins/buttons';
@import 'scss-imports/variables';

@mixin details-cards {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 30px;
  width: 100%;
  word-break: break-word;

  .scroll-window {
    columns: calc(50vw / 2.7);
    gap: 8px;

    @media (max-width: $breakpoint-tablet) {
      columns: 1;
      padding: 0 16px;
    }

    @media (min-width: $breakpoint-tablet) and (max-width: $breakpoint-md) {
      columns: calc(50vw / 1.5);
      padding: 0 16px;
    }

    > * {
      display: inline-block;
      width: 100%;

      &:not(:last-child) {
        margin-bottom: 8px;
      }
    }
  }
}

@mixin details-card {
  border: none;
  border-radius: 0;
  margin: 0;

  mat-card-header {
    align-items: center;
    border-bottom: 1px solid var(--lines);
    justify-content: space-between;
    min-height: 40px;
    padding: 8px 8px 8px 16px;

    .mat-mdc-button {
      flex-shrink: 0;
    }
  }

  .mat-mdc-card-title {
    align-items: center;
    column-gap: 5px;
    display: flex;
    font-size: 1.65rem;
    margin-bottom: 0;

    // Smaller text for smaller screens
    @media (max-width: $breakpoint-flex) {
      font-size: 1.728em;
    }
  }

  mat-card-content {
    margin: 0;
    padding: 16px !important;

    > div {
      padding: 0;
    }
  }

  ngx-skeleton-loader {
    flex: 1;
  }

  .details-item {
    @include fade-in();

    align-items: center;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    margin-bottom: 4px;

    &:first-child {
      margin-top: 0;
    }

    .label {
      font-weight: bold;
      margin-right: 5px;
      white-space: normal;
    }

    .value {
      font-weight: normal;
      margin-right: 5px;
      white-space: normal;
    }

    a {
      color: var(--primary);
      cursor: pointer;
      margin-left: auto;
      max-width: 100%;
      overflow: hidden;
      text-decoration: underline;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    ngx-skeleton-loader {
      display: inline-block;
      flex: 0;
      height: 20px;
      min-width: 30px;
      width: 30%;

      ::ng-deep .loader {
        margin-bottom: 0;
      }
    }
  }

  mat-card-actions {
    border-top: 1px solid var(--lines);
    box-sizing: border-box;
    display: flex;
    justify-content: flex-end;
    margin: 0;
    padding: 8px 8px 8px 16px;

    .mdc-button--outlined {
      @include stroked-button();
    }
  }
}

@mixin resource-cards {
  @include details-cards();

  gap: 16px;

  > * {
    max-width: 360px;
    min-width: 360px;
  }
}

@mixin resource-card {
  @include details-card();

  mat-card-header {
    border-bottom: none;
  }

  mat-card-content {
    align-items: center;
    display: flex;
    justify-content: space-between;

    .value {
      font-size: 3.5em;
      white-space: nowrap;
    }
  }
}

@mixin loader-block {
  background: var(--fg2);
  border-radius: 3px;
  height: 20px;
  opacity: 0.3;
}
